  <%@ page language="java" %>
<%@ page session="true" %>
<%@ page import="java.sql.*,java.io.*,java.util.Random"%>

  <% String userid = request.getParameter("userid");%>

 <HTML>
    <HEAD>

    <script LANGUAGE="Javascript" SRC="Images/validate.js"></script>

    <LINK href="styles.css" type="text/css" rel="stylesheet">
    <script LANGUAGE="Javascript" SRC="Images/calender.js"></script>
    <script LANGUAGE="Javascript" >
		function ChkMandatoryField(F,T){
			var val= F.value;
			if(val==""){alert(T+" is mandatory");return false;}
		}
		function ChkNumField(F,T){
			var val = F.value;
			if(isNaN(val)==true||val==""){alert("Please enter numbers for "+T);return false;}
		}
		function ChkAlphaNumericField(F,T){
			var val = F.value;
			var pattern = /^([a-zA-Z0-9]{1,250})$/;
			if(!(pattern.test(val)==true)){alert("Please enter alphabets or numbers for "+T);return false;}
		}
		function ChkAlphaField(F,T){
			var val = F.value;
			var pattern = /^([a-zA-Z ]{1,250})$/;
			if(!(pattern.test(val)==true)){alert("Please enter text for "+T);return false;}
		}
		function ChkEmailField(F,T){
			var val = F.value;
			var pattern = /^[a-zA-Z0-9\_\.]+\@[a-zA-Z\.]+\.([a-z]{2,4})$/;
			if(!(pattern.test(val)==true)){alert("Please enter valid email for "+T);return false;}
		}
		function ChkDateField(F,T)
		{
			var val = F.value;
		    var pattern = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
		    if(!(pattern.test(val)==true)){alert("Please enter valid date format (yyyy-mm-dd) for "+T);return false;}
		}
		function validate()
		{
			var frm = document.forms(0);
			if(ChkMandatoryField(frm.FirstName,'First Name')==false) return false;
			    if(ChkMandatoryField(frm.LastName,'Last Name')==false) return false;
			    if(ChkMandatoryField(frm.Email,'Email')==false) return false;
			    if(ChkEmailField(frm.Email,'Email')==false) return false;
				if(ChkMandatoryField(frm.ContactNumber,'Contact Number')==false) return false;
if(ChkNumField(frm.ContactNumber,'Contact Number')==false) return false;
			    if(ChkMandatoryField(frm.CurrentLocation,'Current Location')==false) return false;
			    if(ChkMandatoryField(frm.Address,'Address')==false) return false;
		}
	</script>
	</HEAD>
	<Body class=Grad>
	<H2 align=center>Update Contact Information</H2>
	<FORM ACTION="UpdateContact1.jsp" onsubmit="return validate()">
	<TABLE align=center width="50%">
<TR class="row_title">
	<Td align=center>Contact Information<BR></Td>
</TR>		
				<Input type=hidden name='userid' value='<%=userid%>'size=10>

		<TR class=row_odd><TH align="left">First Name
		<FONT COLOR="red">*</TH>
		<TD class=row_even>&nbsp;&nbsp;<Input type=text name='FirstName' value=''>
		</TR>

		<TR class=row_odd><TH align="left">Last Name
		<FONT COLOR="red">*</TH>
		<TD class=row_even>&nbsp;&nbsp;<Input type=text name='LastName' value=''>
		</TR>

		<TR class=row_odd><TH align="left">Email
		<FONT COLOR="red">*</TH>
		<TD class=row_even>&nbsp;&nbsp;<Input type=text name='Email' value=''>
		</TR>

		<TR class=row_odd><TH align="left">Contact Number
		<FONT COLOR="red">*</TH>
		<TD class=row_even>&nbsp;&nbsp;<Input type=text name='ContactNumber' value=''>
		</TR>

		<TR class=row_odd><TH align="left">Current Location
		<FONT COLOR="red">*</TH>
		<TD class=row_even>&nbsp;&nbsp;<Input type=text name='CurrentLocation' value=''>
		</TR>

		<TR class=row_odd><TH align="left">Address
		<FONT COLOR="red">*</TH>
		<TD class=row_even>&nbsp;&nbsp;<textarea name="Address" class=TextField></textarea>
		</TR>

        <TR>
		<TH><INPUT TYPE="submit" value='Update' class=Button></TH>
		<TH><INPUT TYPE="reset" value='Clear' class=Button></TH></TR>
		</TABLE>
	<H6 align=center>Fields with <FONT SIZE="" COLOR="red">*</FONT> are mandatory </H6>
	</FORM>
	</BODY>

